package edu.jd.movieplatform.info.cnmComment.impl;

import edu.jd.movieplatform.info.cnmComment.CnmComment;
import edu.jd.movieplatform.info.cnmComment.CnmCommentDto;
import edu.jd.movieplatform.info.cnmComment.CnmCommentService;
import edu.jd.movieplatform.info.cnmComment.dao.CnmCommentDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @descriptions:
 * @data: 2021/7/19 12:23
 */
@Service
@Transactional
public class CnmCommentServiceImpl implements CnmCommentService {
    @Resource
    private CnmCommentDao dao;

    @Override
    public List<CnmComment> getCnmCommentList(CnmCommentDto dto) {
        return dao.findCnmCommentList(dto);
    }

    @Override
    public void addComment(CnmCommentDto dto) {
        dto.setCom_time(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        dao.createComment(dto);
    }
}
